<%-- 
    Document   : manage_add
    Created on : Oct 24, 2011, 8:26:05 AM
    Author     : Yudi Retanto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="/header.jsp"></jsp:include>
<h1>
    Tambah Jadwal Keberangkatan
</h1>
<script type="text/javascript">
    function changeAirportFrom(){
            $('#sAirportFrom .defCity').remove();
    }
    function changeAirportTo(){
            $('#sAirportTo .defCity').remove();
    }
    $(function() {
        $( "#iDate" ).datepicker({ dateFormat: "yy/mm/dd" });
    });
</script>
<form action="./flights?action=manage&mode=add" method="post" onsubmit="return submit();">
<table id="manageForm">
    <tr>
        <td style="width: 20%;">
            <label for="cityFrom">Airport Keberangkatan :</label>
        </td>
        <td>
            <select id="sAirportFrom" name="airportFrom" onchange="changeAirportFrom();">
                <option class="defAirport" value="0" selected="selected">Pilih Airport Keberangkatan</option>
                <c:forEach items="${airports}" var="airport">
                    <option value="${airport.getID()}">${airport.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td style="width: 20%;">
            <label for="cityTo">Airport Tujuan :</label>
        </td>
        <td>
            <select id="sAirportTo" name="airportTo" onchange="changeAirportTo();">
                <option class="defAirport" value="0" selected="selected">Pilih Airport Tujuan</option>
                <c:forEach items="${airports}" var="airport">
                    <option value="${airport.getID()}">${airport.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="airline">Maskapai Penerbangan :</label>
        </td>
        <td>
            <select name="airline">
                <c:forEach items="${airlines}" var="airline">
                    <option value="${airline.getID()}">${airline.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="class">Kelas Penerbangan :</label>
        </td>
        <td>
            <select name="class">
                <c:forEach items="${classes}" var="clas">
                    <option value="${clas.getID()}">${clas.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td style="width: 20%;">
            <label for="name">Tanggal Keberangkatan :</label>
        </td>
        <td>
            <input type="text" name="date" id="iDate"/>
        </td>
    </tr>
    <tr>
        <td>
            <label for="hour">Waktu Keberangkatan :</label>
        </td>
        <td>
            <select name="hour">
                <%
                    for(int i=0;i<24;i++){
                        out.println("<option value=\""+String.format("%02d", i) +"\">"+String.format("%02d", i)+"</option>");
                    }
                %>
            </select><span> : </span>
            <select name="minute">
                <%
                    for(int i=0;i<60;i++){
                        out.println("<option value=\""+String.format("%02d", i) +"\">"+String.format("%02d", i)+"</option>");
                    }
                %>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="fare">Harga Tiket :</label>
        </td>
        <td>
            <input type="text" name="fare" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="Submit" />
        </td>
    </tr>
</table>
</form>
<jsp:include page="/footer.jsp"></jsp:include>

